<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>小程序网球首页</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 0;
            padding: 0;
            background-color: #f4f4f4;
        }
        .header {
            background-color: #fff;
            padding: 20px;
            text-align: center;
        }
        .carousel {
            position: relative;
            width: 100%;
            max-width: 600px;
            margin: auto;
            overflow: hidden;
        }
        .carousel img {
            width: 100%;
            display: none; /* Hide images initially */
        }
        .search-bar {
            text-align: center;
            margin: 20px 0;
        }
        .search-bar input[type="text"] {
            padding: 10px;
            width: 80%;
            border: 1px solid #ddd;
            border-radius: 5px;
        }
        .feature-box {
            background-color: #fff;
            padding: 20px;
            margin-bottom: 10px;
            text-align: center;
            cursor: pointer;
        }
        .feature-box:hover {
            box-shadow: 0 0 10px rgba(0,0,0,0.1);
        }
    </style>
</head>
<body>
    <header class="header">
        <h1>小程序网球首页11</h1>
    </header>

    <div class="carousel">
        <!-- 循环图片框 -->
        <img src="/asset/img/image1.jpg" alt="图片1">
        <img src="/asset/img/image2.jpg" alt="图片2">
        <img src="/asset/img/image3.jpg" alt="图片3">
        <!-- 这里可以添加更多的图片 -->
    </div>

    <div class="search-bar">
        <!-- 搜索栏 -->
        <input type="text" placeholder="搜索...">
    </div>

    <div class="feature-box" onclick="location.href='#competition';">
        <h2>竞赛</h2>
        <p>查看竞赛信息</p>
    </div>
    <div class="feature-box" onclick="location.href='#training';">
        <h2>培训</h2>
        <p>参加培训课程</p>
    </div>
    <div class="feature-box" onclick="location.href='#partner';">
        <h2>约搭子</h2>
        <p>寻找打球伙伴</p>
    </div>

    <script>
        // JavaScript代码用于实现图片轮播功能
        let currentImageIndex = 0;
        const images = document.querySelectorAll('.carousel img');
        const totalImages = images.length;

        function showImage(index) {
            images.forEach((img, idx) => {
                img.style.display = (idx === index) ? 'block' : 'none';
            });
        }

        showImage(currentImageIndex);

        setInterval(() => {
            currentImageIndex = (currentImageIndex + 1) % totalImages;
            showImage(currentImageIndex);
        }, 3000); // 每3秒切换一次图片
    </script>
</body>
</html>